package org.yjc.service;

import java.util.Optional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.yjc.entity.Audit;
import org.yjc.entity.SysUser;
import org.yjc.repository.AuditRepository;

@Service
public class AuditService {
	@Autowired
	private AuditRepository auditDAO;

	public void save(Audit audit) {
		auditDAO.save(audit);
	}

	public Page<Audit> findAll(Specification<Audit> spec, Pageable pageable) {
		return auditDAO.findAll(spec, pageable);
	}

	public Audit findById(Integer ids) {
		Optional<Audit> optional = auditDAO.findById(ids);
		if(optional.isPresent()) {
			return optional.get();
		}
		return null;
	}

	public Audit findByid(Integer ids) {
		Optional<Audit> optional = auditDAO.findById(ids);
		if(optional.isPresent()) {
			return optional.get();
		}
		return null;
	}

	public void deleteById(Integer ids) {
		auditDAO.deleteById(ids);
	}
}
